package com.example.learn.leetcode;

public class LC62 {
    public int uniquePaths(int m, int n) {
        // dp[m][n]表示从[0][0]到点
        int[][] dp = new int[m][n];
        int i =0;
        while(i<m){
            int j =0 ;

            while(j<n){
                if(i==0) dp[i][j]=1;
                else if(j==0) dp[i][j]=1;
                else dp[i][j] = dp[i][j-1]+dp[i-1][j];
                j++;
            }
            i++;
        }
        return dp[m-1][n-1];

    }
}
